﻿using System;
using System.Diagnostics;
using Xunit;

namespace NPack.Tests
{
    public class TComponentPerformanceTests
    {
        [Fact]
        public void TestAdditionPerf()
        {
            const int count = 10000000;

            var d = 0.0;
            var watch = new Stopwatch();
            watch.Start();
            for (var i = 0; i < count; i++)
            {
                d = d + 1.0d;
            }
            watch.Stop();
            Debug.WriteLine(string.Format("double added in {0}", watch.ElapsedMilliseconds));

            watch.Reset();
            watch.Start();
            var one = new DoubleComponent(1.0d);
            var component = new DoubleComponent(0d);
            for (var i = 0; i < count; i++)
            {
                component = component.Add(one);
            }
            watch.Stop();
            Debug.WriteLine(string.Format("DoubleComponent added in {0}", watch.ElapsedMilliseconds));

        }
    }
}
